package com.tbvtc.agriculturalcreditchainserver2025.vo.ConsumerVo;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.tbvtc.agriculturalcreditchainserver2025.Json.TimesTampSerialized;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;

@Data
public class TraceInfoVo implements Serializable {

    private static final long serialVersionUID = 1L; // 序列化版本号

    @Schema(description = "土地名称")
    private String landName;
    @Schema(description = "土地大小")
    private BigInteger landSize;
    @Schema(description = "土地质量")
    private String landQuality;
    @Schema(description = "土地气候")
    private String climate;
    @Schema(description = "土地类型")
    private String previousCrop;
    @Schema(description = "土地注册时间")
    @JsonSerialize(using = TimesTampSerialized.class)
    private String landRegisterTime;
    @Schema(description = "农作物注册时间")
    @JsonSerialize(using = TimesTampSerialized.class)
    private String cropRegisterTime;
    @Schema(description = "是否收获")
    private Boolean isHarvested;
    @Schema(description = "收获时间")
    @JsonSerialize(using = TimesTampSerialized.class)
    private String harvestTime;

    @JsonCreator
    public TraceInfoVo(List<Object> array) {
        this.landName = (String) array.get(0);
        this.landSize = (BigInteger) array.get(1);
        this.landQuality = (String) array.get(2);
        this.climate = (String) array.get(3);
        this.previousCrop = (String) array.get(4);
        this.landRegisterTime = ((Number) array.get(5)).toString();
        this.cropRegisterTime = ((Number) array.get(6)).toString();
        this.isHarvested = (Boolean) array.get(7);
        this.harvestTime = ((Number) array.get(8)).toString();
    }
    public TraceInfoVo() {}

}
